package com.gitee.cirnochat.file.model.vo.resp;

import com.gitee.cirnochat.file.model.entity.EmojiPackItem;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.time.ZoneOffset;

/**
 * 表情包响应对象
 */
@Schema(name = "EmojiPackItemUpdateResponse", description = "表情包更新响应对象")
@Data
@NoArgsConstructor
public class EmojiPackItemCreateResponse implements Serializable {
    /**
     * 主键ID
     */
    @Schema(description = "表情包项ID", example = "1")
    private Long emojiId;


    @Schema(description = "表情包项图片URL", example = "https://example.com/image.png")
    private String fileUrl;
    /**
     * 图片文件ID
     */
    @Schema(description = "表情包项图片文件ID", example = "123456789")
    private Long fileId;
    /**
     * 创建时间
     */
    @Schema(description = "表情包项创建时间", example = "117151514000")
    private Long emojiCreateTime;
    /**
     * 更新时间
     */
    @Schema(description = "表情包项更新时间", example = "117151514000")
    private Long emojiUpdateTime;

    public EmojiPackItemCreateResponse(EmojiPackItem emojiPackItem, FileUploadResponse fileUploadResponse) {
        this.emojiId = emojiPackItem.getId();
        this.emojiCreateTime = emojiPackItem.getCreateTime().toEpochSecond(ZoneOffset.UTC);
        this.emojiUpdateTime = emojiPackItem.getUpdateTime().toEpochSecond(ZoneOffset.UTC);
        this.fileId = emojiPackItem.getFileId();
        this.fileUrl = fileUploadResponse.getFileUrl();
    }
}